enum AppEnv {
  // 测试环境服务
  debug('debug'),
  // 线上环境服务
  release('release');

  final String value;

  const AppEnv(this.value);
}

class AppEnvironment {
  static AppEnvironment? _instance;
  final AppEnv env;

  AppEnvironment._(this.env);

  static void initialize(AppEnv env) {
    _instance = AppEnvironment._(env);
  }

  static AppEnvironment get instance {
    assert(_instance != null, 'AppEnvironment 必须要先初始化');
    return _instance!;
  }

  // 获取当前环境对应的域名
  String get baseUrl {
        return 'http://127.0.0.1:8888';

        //return 'http://124.220.65.223:8888';
  }

  //securityInfo 情报库
  String get kSecurityInfo {
    return '$baseUrl/v1/site/m_securityInfo';
  }

  String get cookieDomain {
    return '/v1';
  }
  String get userAgentPre {

    return 'rongfei bogApp myblog/';

  }
  bool get isRelease {
    switch (env) {
      case AppEnv.debug:
        return false;
      case AppEnv.release:
        return true;
    }
  }
}
